import { createRouter, createWebHashHistory, createWebHistory, RouteRecordRaw } from 'vue-router';

export const constantRoutes : Array<RouteRecordRaw> = [
	{
		path: '/login',
		component: () => import('@/views/login/index.vue'),
		meta: {
			title: '登录'
		}
	},
	{
		path: '/404',
		component: () => import('@/views/error-page/404.vue'),
		meta: {
			title: '404'
		}
	},
	{
		path: '/401',
		component: () => import('@/views/error-page/401.vue'),
		meta: {
			title: '401'
		}
	},
	{
		path: '/',
		component: () => import('@/layout/index.vue'),
		redirect: '/dashboard',
		children: [
			{
				path: '/dashboard',
				component: () => import('@/views/dashboard/largeScreen.vue'),
				name: 'dashboard',
				meta: { title: '可视化大屏', icon: 'Monitor', affix: true },
			}, {
				path: '/templateManagement',
				component: () => import('@/views/templateManagement/index.vue'),
				name: 'templateRouter',
				meta: { title: '巡检对象模板管理', icon: 'DocumentCopy', affix: true },
				children:[
					{
						path:'',
						component: () => import('@/views/templateManagement/TemplateManagement.vue'),
						name: 'templateManagement',
						meta: { title: '巡检对象模板管理', icon: 'Monitor', affix: true, hide:true },
					},
					{
						path: 'inspectionItems',
						component: () => import('@/views/templateManagement/InspectionItems.vue'),
						name: 'tempinspectionItems',
						meta: { title: '巡检项管理', icon: 'Monitor', affix: true, hide:true },
					}
				]
			}, 
			{
				path: '/inspectionObject',
				component: () => import('@/views/InspectionObject/index.vue'),
				name: 'objectRouter',
				meta: { title: '巡检对象管理', icon: 'Position', affix: true },
				children:[
					{
						path:'',
						component: () => import('@/views/InspectionObject/InspectionObject.vue'),
						name: 'inspectionObj',
						meta: { title: '巡检对象管理', icon: 'Monitor', affix: true, hide:true },
					},
					{
						path: 'inspectionItems',
						component: () => import('@/views/templateManagement/InspectionItems.vue'),
						name: 'objinspectionItems',
						meta: { title: '巡检项管理', icon: 'Monitor', affix: true, hide:true },
					},
					{
						path: 'labelManage',
						component: () => import('@/views/InspectionObject/ObjectLabelManage.vue'),
						name: 'labelManage',
						meta: { title: '识别标签管理', icon: 'Monitor', affix: true, hide:true },
					},
					{
						path: 'inspectionHistory',
						component: () => import('@/views/InspectionObject/InspectionHistory.vue'),
						name: 'inspectionHistory',
						meta: { title: '查看历史巡检结果', icon: 'Monitor', affix: true, hide:true },
					},
					{
						path: 'exportHistory',
						component: () => import('@/views/InspectionObject/MultiInspectionHistory.vue'),
						name: 'exportHistory',
						meta: { title: '导出巡检表', icon: 'Monitor', affix: true, hide:true },
					},
				]
			}, 
			{
				path: '/inspectionTask',
				component: () => import('@/views/InspectionTask/index.vue'),
				name: 'taskRouter',
				meta: { title: '巡检任务', icon: 'Calendar', affix: true },
				children:[
					{
						path:'',
						component: () => import('@/views/InspectionTask/InspectionTask.vue'),
						name: 'inspectionTask',
						meta: { title: '巡检任务', icon: 'Monitor', affix: true, hide:true },
					},
					{
						path:'manualTask',
						component: () => import('@/views/InspectionTask/ManualTask.vue'),
						name: 'manualTask',
						meta: { title: '手动生成巡检任务', icon: 'Monitor', affix: true, hide:true },
					},
					{
						path:'view',
						component: () => import('@/views/InspectionTask/InspectionViewer.vue'),
						name: 'view',
						meta: { title: '查看任务巡检项', icon: 'Monitor', affix: true, hide:true },
					},
					{
						path:'execute',
						component: () => import('@/views/InspectionTask/InspectionResult.vue'),
						name: 'execute',
						meta: { title: '查看任务执行结果', icon: 'Monitor', affix: true, hide:true },
					},
				]
			}, 
			{
				path: '/correction',
				component: () => import('@/views/correction/correction.vue'),
				name: 'correction',
				meta: { title: '整改登记', icon: 'Document', affix: true },
			},
			
			{
				path: '/system_management',
				component: () => import('@/views/system_management/index.vue'),
				name: 'systemRouter',
				meta: { title: '系统设置', icon: 'Setting' },
				redirect:'/system_management/dimension',
				children: [

					{
						path: 'dimension',
						component: () => import('@/views/system_management/spatialDimension.vue'),
						name: 'spatialDimension',
						meta: { title: '关联空间维度' }
					}, {
						path: 'cycleManagement',
						component: () => import('@/views/system_management/cycleManage/index.vue'),
						name: 'cycleManagement',
						meta: { title: '巡检周期管理', icon: 'Monitor', affix: true },
					}, {
						path: 'groupManagement',
						component: () => import('@/views/system_management/groupManage/index.vue'),
						name: 'groupManagement',
						meta: { title: '对象分组管理', icon: 'Monitor', affix: true },
					},
					{
						path: 'calendar',
						component: () => import('@/views/system_management/calendar/index.vue'),
						name: 'calendar',
						meta: { title: '工作日历', icon: 'Monitor', affix: true },
					},

				]
			}
		]
	}
];

const router = createRouter({
	history: createWebHistory(),
	routes: constantRoutes
});

export default router;